namespace TS2015.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class recreat : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.TbDanToc",
                c => new
                    {
                        MaDanToc = c.Int(nullable: false, identity: true),
                        TenDanToc = c.String(nullable: false, maxLength: 50),
                        MoTa = c.String(),
                    })
                .PrimaryKey(t => t.MaDanToc);
            
            CreateIndex("dbo.TbThiSinh", "MaKhuVuc");
            CreateIndex("dbo.TbThiSinh", "MaXepLoaiHS");
            CreateIndex("dbo.TbThiSinh", "MaDanToc");
            AddForeignKey("dbo.TbThiSinh", "MaDanToc", "dbo.TbDanToc", "MaDanToc");
            AddForeignKey("dbo.TbThiSinh", "MaKhuVuc", "dbo.TbKhuVuc", "MaKhuVuc");
            AddForeignKey("dbo.TbThiSinh", "MaXepLoaiHS", "dbo.TbXepLoaiHS", "MaXepLoaiHS");
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.TbThiSinh", "MaXepLoaiHS", "dbo.TbXepLoaiHS");
            DropForeignKey("dbo.TbThiSinh", "MaKhuVuc", "dbo.TbKhuVuc");
            DropForeignKey("dbo.TbThiSinh", "MaDanToc", "dbo.TbDanToc");
            DropIndex("dbo.TbThiSinh", new[] { "MaDanToc" });
            DropIndex("dbo.TbThiSinh", new[] { "MaXepLoaiHS" });
            DropIndex("dbo.TbThiSinh", new[] { "MaKhuVuc" });
            DropTable("dbo.TbDanToc");
        }
    }
}
